out.js ➔ ???   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 19

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 3.6875

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
c 1
b 0
f 0
nc 2
nop 1
dl 0
loc 19
ccs 2
cts 8
cp 0.25
crap 3.6875
rs 9.4285

1 Function

Rating   Name   Duplication   Size   Complexity  
A out.js ➔ ... ➔ ??? 0 11 2
1
"use strict";
2
3
const Response = require('../../model/Response');
4
5
/**
6
 * @param {Response} response
7
 *
8
 * @returns {Object}
9
 */
10
module.exports = response => {
11
    const format = object => {
12 2
        if (object instanceof Response) {
13
            return {
14
                body: object.getBody(),
15
                statusCode: object.getStatusCode(),
16
                headers: object.getHeaders()
17
            };
18
        }
19
20
        return object;
21
    };
22
23 2
    if (Array.isArray(response)) {
24
        return response.map(format);
25
    }
26
27
    return format(response);
28
};
29